/**
 * Copyright 2008 by Robert Konigsberg
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the same terms as Perl.
 *
 * @see http://www.perl.com/perl/misc/Artistic.html
 */
package visitor.maze;

import org.testng.annotations.Test;

@Test
public class MazeTest {

  @Test
  public void testMaze() {
    Maze maze = new Maze();
    assert maze.getRoomIds().size() == 0;

    Room room1 = new Room(1);

    maze.addRoom(room1);

    assert maze.getRoomIds().size() == 1;
    assert maze.getRoomIds().iterator().next() == 1;
    assert maze.getRoom(1) == room1;
  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void addSameRoomTwice() {
    Maze maze = new Maze();
    Room room1 = new Room(1);
    maze.addRoom(room1);
    maze.addRoom(room1);
  }

  @Test(expectedExceptions=IllegalArgumentException.class)
  public void addIdenticalRoomTwice() {
    Maze maze = new Maze();
    Room room1 = new Room(1);
    Room room1a = new Room(1);
    maze.addRoom(room1);
    maze.addRoom(room1a);
  }
}
